//
//  TwoVC.m
//  ZPrograme
//
//  Created by 周成龙 on 16/6/17.
//  Copyright © 2016年 none. All rights reserved.
//

#import "TwoVC.h"

#import "VDJConstant.h"
#import "ThreeVC.h"

#import "AlipayManager.h"
#import "UMengManager.h"

#import "UIImageView+WebCache.h"
#import "ChatViewController.h"

@interface TwoVC ()

@property (nonatomic, strong)UIButton *rightButton;

@end

@implementation TwoVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.titleLabel.text = @"TwoVC";
    
    
    
    self.rightButton = [[UIButton alloc] init];
    self.rightButton.frame = CGRectMake(kScreenWidth - 100, 20, 100, 44);
    [self.navBarView addSubview:self.rightButton];
    [self.rightButton addTarget:self action:@selector(right) forControlEvents:UIControlEventTouchUpInside];
    [self.rightButton setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
    [self.rightButton setTitle:@"不要啊" forState:UIControlStateNormal];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.drag = kCanDrag;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.drag = kCanNotDrag;
}

- (void)right
{
//    ThreeVC *vc = [ThreeVC new];
//    [self.navigationController pushViewController:vc animated:YES];
    
//    AlipayManager *manager = [AlipayManager sharedInstance];
//    manager.totalFee = @"0.01";
//    manager.outTradeNO = [self generateTradeNO];
//    manager.subject = @"测试";
//    manager.body = @"商品藐视";
//    [manager alipayWithHandleAction:^{
//        MyLog(@"-------");
//    }];

    
//    UMengManager *manager = [UMengManager manager];
////    [manager shareQQWithVC:self withShareURL:@"https://www.baidu.com" withUrlResource:@"http://img01.taopic.com/140911/318742-140911002G888.jpg" withShareTitle:@"测试分享标题！！！" withShareText:@"测试分享文本！！！"];
//    
//    [manager shareWeiXinWithVC:self withShareURL:@"https://www.baidu.com" withUrlResource:@"http://img01.taopic.com/140911/318742-140911002G888.jpg" withShareTitle:@"测试分享标题！！！" withShareText:@"测试分享文本！！！"];
    
    
    
    ChatViewController *vc = [[ChatViewController alloc] initWithConversationChatter:@"13918378346" conversationType:EMConversationTypeChat];
    vc.title = @"13918378346";
    [self.navigationController pushViewController:vc animated:YES];
}

- (NSString *)generateTradeNO
{
    static int kNumber = 15;
    
    NSString *sourceStr = @"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    NSMutableString *resultStr = [[NSMutableString alloc] init];
    srand((unsigned)time(0));
    for (int i = 0; i < kNumber; i++)
    {
        unsigned index = rand() % [sourceStr length];
        NSString *oneStr = [sourceStr substringWithRange:NSMakeRange(index, 1)];
        [resultStr appendString:oneStr];
    }
    return resultStr;
}


@end
